#!/bin/sh
# - priority
# - vma_swap_readahead

. "$LKP_SRC"/lib/common.sh
. "$LKP_SRC"/lib/reproduce-log.sh

if [ -z "$partitions" ]; then
	echo "no partitions found" >&2
	exit 1
fi

[ -n "$priority" ] && opt_priority="-p $priority"

log_cmd swapoff -a
for i in $partitions; do
	log_cmd mkswap $i 2>/dev/null && log_cmd swapon $i $opt_priority
done

[ -n "$vma_swap_readahead" ] &&
	log_write_file /sys/kernel/mm/swap/vma_ra_enabled $(parse_bool "$vma_swap_readahead")

# verify swap priority
cat /proc/swaps
